<?php namespace App\Http\Middleware;

use Closure;

class AuthenticationAuth
{

    public function __construct()
    {
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $session = $request->getSession();
        $value = $session->get('userinfo');
        if ($value == null) {
            return redirect('authentication/login');
        }

        return $next($request);
    }

}